package com.winai.launcher.override;

import android.content.Context;
import android.widget.TextView;
import android.widget.Toast;

import com.ks.projectbasictools.base.SimpleView;
import com.winai.launcher.R;

public class ToastKs {
    private static Toast toast;

    public ToastKs() {
    }

    public static void show(Context context, String messages) {
        if (toast != null) {
            toast.cancel();
            toast = null;
        }

        SimpleView simpleView = new SimpleView(context, R.layout.toast_style);
        TextView text = simpleView.findViewById(R.id.tvTextToast);
        text.setText(messages);
        if (toast == null) {
            toast = new Toast(context);
        }

        toast.setGravity(17, 0, 0);
        toast.setDuration(Toast.LENGTH_LONG);
        toast.setView(simpleView);
        toast.show();
    }
}
